<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>操作日志 </title>
    <meta name="keywords" content="设置关键词..."/>
    <meta name="description" content="设置描述..."/>
    <meta name="author" content="DeathGhost"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <link rel="icon" href="images/icon/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <link rel="stylesheet" type="text/css" href="BootStrap/css/bootstrap.css">

    <script src="BootStrap/js/jquery.js"></script>
    <script src="BootStrap/js/bootstrap.js"></script>
</head>
<body>
<div class="page-wrap">
    <section class="page-hd">
        <header>
            <h2 class="title">操作日志</h2>
        </header>
        <hr>
    </section>
    <div class="breadcrumb">
        <ul>
            <li><a>设置</a><i class="icon-angle-right"></i></li>
            <li><a href="gudonghefenxiaoshangtable.html">操作日志</a><i class="icon-angle-right"></i></li>
            <li>详情</li>
        </ul>
    </div>
    <div class="breadcrumb">
        <ul>
            <li id="count">操作记录总数：</li>
        </ul>
    </div>
</div>



<div class="breadcrumb">
    <table class="table table-striped table-bordered table-hover" style="width: 100%;margin: 20px auto">
        <thead>
        <tr class='cen'>
            <th>编号</th>
            <th>操作者</th>
            <th>操作模块</th>
            <th>操作内容</th>
            <th>IP</th>
            <th>操作时间</th>
        </tr>
        </thead>
        <tbody id="tbody">

        </tbody>
    </table>
    <ul class="pagination pull-right" id="page">

    </ul>
</div>

<script>
    getAll(1);

    function getAll(pageNumber) {

        $.ajax({
            url: '/log/list',
            type: 'post',
            data: {"pageNumber": pageNumber},
            success: function (data) {
                if (data.result == true) {
                    var str = "";
                    var count =0;
                    for (var i = 0; i < data.rizhi.length; i++) {
                        str += "<tr class='cen'>";
                        str += "<td >" + data.rizhi[i].logid + "</td>";
                        str += "<td>" + data.rizhi[i].sesUser.username + "</td>";
                        str += "<td>" + data.rizhi[i].logmodule + "</td>";
                        str += "<td>" + data.rizhi[i].logcontext + "</td>";
                        str += "<td>" + data.rizhi[i].logip + "</td>";
                        str += "<td>" + data.rizhi[i].logtime + "</td>";
                        str += "</tr>";
                        count++;
                    }
                    $("#tbody").html(str);
                    $("#count").html("操作记录总数："+data.page.total);
                    var page = "";
                    page += '<li class="' + (data.page.pageNum == 1 ? 'disabled' : '') + '"><a onclick="getAll(' + data.page.prePage + ')" >上一页</a></li>';
                    for (var i = 1; i <= data.page.pages; i++) {
                        page += ' <li class="' + (data.page.pageNum == i ? 'active' : '') + '"><a onclick="getAll(' + i + ')">' + i + '<span class="sr-only"></span></a></li>';
                    }
                    page += ' <li ><a onclick="getAll(' + data.page.nextPage + ')" >下一页</a></li>';
                    $("#page").html(page);
                }

            }
        });

    }



</script>
</body>
</html>